package cn.wolfcode.shop.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import com.alibaba.dubbo.config.annotation.Service;

import cn.wolfcode.shop.domain.Property;
import cn.wolfcode.shop.mapper.PropertyMapper;
import cn.wolfcode.shop.service.IPropertyService;

@Service
@Transactional
public class PropertyServiceImpl implements IPropertyService {

	@Autowired
	private PropertyMapper propertyMapper;

	@Override
	public List<Property> getCatalogProperty(Long catalogId) {

		return propertyMapper.getCatalogProperty(catalogId);
	}

	@Override
	public void saveOrUpdate(Property entity) {

		if (entity.getId() == null) {
			propertyMapper.insert(entity);
		} else {
			propertyMapper.updateByPrimaryKey(entity);
		}
	}

	@Override
	public void delete(Long id) {
		propertyMapper.deleteByPrimaryKey(id);
	}

}
